<template>
  <h1>El组件-消息提示</h1>
  <el-button type="success" @click="f(1)">成功消息</el-button>
  <el-button type="danger" @click="f(2)">失败消息</el-button>
  <el-button type="warning" @click="f(3)">警告消息</el-button>
  <el-button type="info" @click="f(4)">普通消息</el-button>
  <el-button type="primary" @click="f(5)">可关闭的消息</el-button>
</template>
<script setup>
  import {ElMessage} from "element-plus";

  const f = (t)=>{
    switch (t){
      case 1:
        ElMessage.success('这是一条成功消息');
        break;
      case 2:
        ElMessage.error('这是一条错误消息');
        break;
      case 3:
        ElMessage.warning('这是一条警告消息');
        break;
      case 4:
        ElMessage.info('这是一条消息提示');
        break;
      case 5:
        ElMessage({
          message: '这是一条消息提示',
          showClose: true
        })
    }
  }
</script>


<style scoped>

</style>